function getQuotaData(nodes){
	var quotas = [];
	for(var o in nodes){
		var node = nodes[o];
		var quota = node;
		if(node.checked){
			quotas.push(quota);
			if(node.children || node.isParent){
				getCheckedNodes(node.children, quota);
			}
		}
	}
	function getCheckedNodes(nodes, quotas){
		quotas.children = [];
		for(var o in nodes){
			var node = nodes[o];
			var quota = node;
			if(node.checked){
				quotas.children.push(quota);
				if(node.children || node.isParent){
					getCheckedNodes(node.children, quota);
				}
			}
		}
	}
	return quotas;
}

//封装页面初始化开始加载指标的方法
function getQuotas(pageCode, loadData, container){
	$.post(contextPath + "/quota/getQuotas.dhc", {pageCode: pageCode}).done(function(data){
		if(data.data.length==0){
			drgUI.error('没有配置指标,请联系管理员!');
		}
		totalQuota = arrayToTree(data.data, "id", "pid");
		var zTrees = $.extend(true, [], totalQuota);
		totalQuota = getQuotaData(totalQuota);
		loadData(totalQuota);
		loadQuotaSettings(pageCode, loadData, zTrees, container);
	});
}

//加载指标配置页面
function loadQuotaSettings(pageCode, loadData, zTrees, container){
	var quotaSettingBtn = $('<div class="ti" style="float:right; cursor:pointer;">指标配置</div>');
	$("#"+tabId+" #"+container).before(quotaSettingBtn);
	quotaSettingBtn.bind("click", function(){
		$.post(contextPath+"/pages/common/quota-tree.jsp").done(function(data){
			var dialog  = $(data);
			dialog.find(".modal-title").html("指标配置选项");
			var str = '';
			str += '<div class="zTreeDemoBackground">';
			str += '<ul id="treeDemo" class="ztree"></ul>';
			str += '</div>"';
			dialog.find(".echartscq").html(str);
			
			var setting = {
					view: {
						selectedMulti: false
					},
					check: {
						enable: true
					}
				};
			$.fn.zTree.init(dialog.find("#treeDemo"), setting, zTrees);
			dialog.find('#save').on('click', function(){
				dialog.find('#save').attr("disabled", "");
				var zTree = $.fn.zTree.getZTreeObj("treeDemo");
				zTrees = zTree.getNodes();
				var nodes =  $.extend(true, [], zTrees);
				totalQuota = getQuotaData(nodes);
				var zTreeSimp = zTree.transformToArray(zTrees);
				var ajaxCount = zTreeSimp.length;
				var ajaxS = 0;
				var errorLog;
				for(var o in zTreeSimp){
					var node = zTreeSimp[o];
					node.pageCode = pageCode;
					$.post(contextPath + "/quota/saveQuotas.dhc", {param: JSON.stringify(node)}).done(function(data){
						ajaxS ++;
						if(!data.success){
							errorLog += "指标("+node.code+")报错\n"+data.errorMessage;
							errorLog += "\n";
						}
					})
				}
				var timer = setInterval(function(){
					if(ajaxS == ajaxCount){
						clearInterval(timer);
						if(errorLog){
							dialog.modal('hide');
							drgUI.error(errorLog);
						}else{
							dialog.trigger('complete');
						}						
					}
				}, 500);
			}).end().modal({
				keyboard : false
			}).on({
				'hidden.bs.modal' : function() {
					dialog.remove();
				},
				'complete' : function() {
					dialog.modal('hide');
					
					loadData(totalQuota);
	            }
			});
		})
	});
}

/*
 * 加载页面全院部分页面数据
 */
function loadWardAllQuota(monitorType, totalQuota, divId,commonul) {
	paramTabPage[tabId].wardCode==$("#" + tabId + " #wardCode").val();
	var str = '';
	var ul = '';
	for (var o in totalQuota) {
		var quotaTypes = totalQuota[o].children;
		if (totalQuota.length > 0) {
			// 拼接ul
			if (o == 0) {
				ul += '<li role="presentation" class="active">';
			} else {
				ul += '<li role="presentation">';
			}
			ul += '<a href="#' + totalQuota[o].code + 'QuaId-hosp' + tabId
					+ '" role="tab" data-toggle="tab" class="top-tab">'
					+ totalQuota[o].name + '</a>';
			ul += '</li>';
	       $("#" + tabId +" #"+commonul).html(ul);
			// 开始拼接div
			if (o == 0) {
				str += '<div role="tabpanel" class="tab-pane active" id="'
						+ totalQuota[o].code + 'QuaId-hosp' + tabId + '">';
			} else {
				str += '<div role="tabpanel" class="tab-pane" id="'
						+ totalQuota[o].code + 'QuaId-hosp' + tabId + '">';
			}
			str += '<div class="paddingd10">';
			str += '<div class="row" >';
		}
		for (var o in quotaTypes) {
			var quotas = quotaTypes[o];
			str += ' <div class="col-xs-4"> ';
			str += '     <div class="infocq"> ';
			str += '         <div class="tii margind10"><span>'
					+ quotas.name + '</span></div> ';
			str += '         <div class="ci"> ';
			for (var o1 in quotas.children) {
				var quota = quotas.children[o1];
				var quotaCode = quota.code;
				var quotaName = quota.name;
				var quotaType = quota.type;
				str += '             <div class="row contotalcq2"> ';
				str += '                <div class="col-xs-6">'+ quotaName + '</div> ';
				if("ratio"==quotaType){
					str += '                 <div class="col-xs-6" id="'+quotaCode+'-value">'+getQuotaValue(quotaCode, monitorType, function(value, valuecc, code){
						$("#" + tabId + " #" + divId + " #"+code+"-value").html(comparePercent(value, valuecc));
					})+'</div> ';
				}else{
					str += '                 <div class="col-xs-6" id="'+quotaCode+'-value">'+getQuotaValue(quotaCode, monitorType, function(value, valuecc, code){
						$("#" + tabId + " #" + divId + " #"+code+"-value").html(compareValue(value, valuecc));
					})+'</div> ';
				}
				str += '             </div> ';
			}
			str += '         </div> ';
			str += '     </div> ';
			str += ' </div> ';
		}
		if (totalQuota.length > 0) {
			str += '</div>';
			str += '</div>';
			str += '</div>';
		}
	}
	$("#" + tabId + " #" + divId).html(str);
}

function getQuotaValue(quotaCode, monitorType, callback){
	$.post(contextPath + "/Monitor/monitor.dhc", {
		'dateFrom' : paramTabPage[tabId].dateFrom,
		'dateTo' : paramTabPage[tabId].dateTo,
		'mrLot' : paramTabPage[tabId].mrLot,
		'mrType' : paramTabPage[tabId].mrType,
		'compareType' : paramTabPage[tabId].compareType,
		'pType' : paramTabPage[tabId].pType,
		'monitorType' : monitorType,
		'quotaCode' : quotaCode,
		'pardepCode' : paramTabPage[tabId].depCode,
		'pardepgroupCode' : paramTabPage[tabId].depGroupCode,
		'pargroupName' : paramTabPage[tabId].groupName,
		'parwardCode' : paramTabPage[tabId].wardCode,
		'parmdcCode' : paramTabPage[tabId].mdcCode,
		'paradrgCode' : paramTabPage[tabId].adrgCode,
		'pardrgCode' : paramTabPage[tabId].drgCode
	}).done(function(data) {
		if(data.success){
			if(data.data.length>0){
				data = data.data[0];
				callback(data.QuotaValue, data.QuotaValuecc, quotaCode);
			}else{
				callback("", "", quotaCode);
			}
		}else{
			callback("", "", quotaCode);
		}
	});
	return "";
}

function loadDepGrouppartmentAllQuota(monitorType, totalQuota, divId,commonul) {
	paramTabPage[tabId].depGroupCode=$("#" + tabId + " #depGroupCode").val();		
	paramTabPage[tabId].depCode='';
	var str = '';
	var ul = '';
	for (var o in totalQuota) {
		var quotaTypes = totalQuota[o].children;
		if (totalQuota.length > 0) {
			// 拼接ul
			if (o == 0) {
				ul += '<li role="presentation" class="active">';
			} else {
				ul += '<li role="presentation">';
			}
			ul += '<a href="#' + totalQuota[o].code + 'QuaId-depgroup' + tabId+ '" role="tab" data-toggle="tab" class="top-tab">'+ totalQuota[o].name + '</a>';
			ul += '</li>';
	       $("#" + tabId +" #"+commonul).html(ul);
			// 开始拼接div
			if (o == 0) {
				str += '<div role="tabpanel" class="tab-pane active" id="'
						+ totalQuota[o].code + 'QuaId-depgroup' + tabId + '">';
			} else {
				str += '<div role="tabpanel" class="tab-pane" id="'
						+ totalQuota[o].code + 'QuaId-depgroup' + tabId + '">';
			}
			str += '<div class="paddingd10">';
			str += '<div class="row" >';
		}
		for (var o in quotaTypes) {
			var quotas = quotaTypes[o];
			str += ' <div class="col-xs-4"> ';
			str += '     <div class="infocq"> ';
			str += '         <div class="tii margind10"><span>'
					+ quotas.name + '</span></div> ';
			str += '         <div class="ci"> ';
			for (var o1 in quotas.children) {
				var quota = quotas.children[o1];
				var quotaCode = quota.code;
				var quotaName = quota.name;
				var quotaType = quota.type;
				str += '             <div class="row contotalcq2"> ';
				str += '                <div class="col-xs-6">'+ quotaName + '</div> ';
				if("ratio"==quotaType){
					str += '                 <div class="col-xs-6" id="'+quotaCode+'-value">'+getQuotaValue(quotaCode, monitorType, function(value, valuecc, code){
						$("#" + tabId + " #" + divId + " #"+code+"-value").html(comparePercent(value, valuecc));
					})+'</div> ';
				}else{
					str += '                 <div class="col-xs-6" id="'+quotaCode+'-value">'+getQuotaValue(quotaCode, monitorType, function(value, valuecc, code){
						$("#" + tabId + " #" + divId + " #"+code+"-value").html(compareValue(value, valuecc));
					})+'</div> ';
				}
				str += '             </div> ';
			}
			str += '         </div> ';
			str += '     </div> ';
			str += ' </div> ';
		}
		if (totalQuota.length > 0) {
			str += '</div>';
			str += '</div>';
			str += '</div>';
		}
	}
	$("#" + tabId + " #" + divId).html(str);
}
     
// 拼接页面布局
function loadWardQuota(totalQuota, monitorName, divId,commonul) {
	var sign=totalQuota[0].code;
	if (!monitorName)
		monitorName = ""
	if (paramTabPage[tabId].compareType == "year") {
		compareName = "同期";
	} else if (paramTabPage[tabId].compareType == "month") {
		compareName = "上期";
	} else if (paramTabPage[tabId].compareType == "manage") {
		compareName = "绩效";
	} else if (paramTabPage[tabId].compareType == "std") {
		compareName = "标杆";
	}
	var str = '';
	var ul = '';
	for (var o in totalQuota) {
		var QuotaCode = totalQuota[o].children;				
		// 拼接ul
		if (totalQuota.length > 0) {
			if (o == 0) {
				ul += '<li role="presentation" class="active">';
			} else {
				ul += '<li role="presentation">';
			}
			ul += '<a href="#' + totalQuota[o].code + 'QuaId' + tabId
			+ '" role="tab" data-toggle="tab" class="top-tab">' + totalQuota[o].name
			+ '</a>';
			ul += '</li>';
			$("#" + tabId +" #"+commonul).html(ul);
		}
		// 开始拼接div
		if (o == 0) {
			str += '<div role="tabpanel" class="tab-pane active" id="'
				+ totalQuota[o].code + 'QuaId' + tabId + '">';
		} else {
			str += '<div role="tabpanel" class="tab-pane" id="'
				+ totalQuota[o].code + 'QuaId' + tabId + '">';
		}

		for (var o in QuotaCode) {
			var quotas = QuotaCode[o];
			str += ' <div class="paddingd10"> ';
			str += '   <div class="tabconti">' + quotas.name + '</div> ';
			str += '   <ul class="nav nav-tabs tabconulcq" role="tablist"> ';
			for (var o1 in quotas.children) {
				var quota = quotas.children[o1];
				var quotaCode = quota.code;
				var quotaName = quota.name;
				if (o1 == 0) {
					str += '       <li role="presentation" class="active"> ';
				} else {
					str += '       <li role="presentation"> ';
				}
				str += '           <a href="#' + quotaCode + '-tc' + tabId+ '" role="tab" data-toggle="tab">' + quotaName+ '</a> ';
				str += '       </li> ';
			}
			str += '   </ul> ';
			str += '   <div class="clearfix"></div> ';
			str += '   <div class="tab-content"> ';
			for (var o1 in quotas.children) {
				var quota = quotas.children[o1];
				var quotaCode = quota.code;
				var quotaName = quota.name;
				if (o1 == 0) {
					str += '       <div role="tabpanel" class="tab-pane active" compareName="'+ compareName+ '" monitorName="'+ monitorName
					+ '" quotaName="'+ quotaName+ '" quotaCode="'+ quotaCode+ '" id="'+ quotaCode+ '-tc'+ tabId+ '"> ';
				} else {
					str += '       <div role="tabpanel" class="tab-pane" compareName="'+ compareName+ '" monitorName="'+ monitorName+ '" quotaName="'+ quotaName+ '" quotaCode="'+ quotaCode+ '" id="'+ quotaCode+ '-tc'+ tabId+ '"> ';}
					str += '           <div class="row padding100"> ';
					str += '               <div class="col-xs-6"> ';
					str += '                   <div class="echartscq" style="height:400px;width:566px;"></div> ';
					str += '               </div> ';
					str += '               <div class="col-xs-6 dataChangeSel"> ';
					str += '                   <table id="'+ quotaCode+ '-table'+ tabId+ '" class="table table-striped" cellspacing="0" width="100%" role="grid" aria-describedby="example_info"> ';
					str += '                       <caption class="contaotalsccq">'+ monitorName + quotas.name + '(' + quotaName+ ')</caption> ';
					str += '                       <thead> ';
					str += '                           <tr role="row"> ';
					str += '                               <th tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-sort="ascending">'+ monitorName + '</th> ';
					str += '                               <th tabindex="0" aria-controls="example" rowspan="1" colspan="1">本期值</th> ';
					str += '                               <th tabindex="0" aria-controls="example" rowspan="1" colspan="1">'+ compareName + '值</th> ';
					str += '                               <th tabindex="0" aria-controls="example" rowspan="1" colspan="1">增长率</th> ';
					str += '                               <th tabindex="0" aria-controls="example" rowspan="1" colspan="1">操作</th> ';
					str += '                           </tr> ';
					str += '                       </thead> ';
					str += '                       <tbody></tbody> ';
					str += '                   </table> ';
					str += '               </div> ';
					str += '           </div> ';
					str += '       </div> ';
			}
			str += '   </div> ';
			str += ' </div> ';
		}
		str += '</div>';		
	}
	$("#" + tabId + " #" + divId).html(str);
}
     
// 根据totalQuota循环加载数据
function loadWardQuotaData(totalQuota, monitorType, functionOne,operfunctionTwo) {
	for (var o in totalQuota) {
		var quotaTypes = totalQuota[o].children;
		for (var o in quotaTypes) {
			var quotas = quotaTypes[o];
			for (var o1 in quotas.children) {
				var quota = quotas.children[o1];
				var quotaCode = quota.code;
				var quotaName = quota.name;
				var quotaType = quota.type;
				loadDRGsQuotaDatasub(quotaCode, quotaName,quotaType,monitorType,functionOne, operfunctionTwo);// 最后两个参数为本页面自定义的方法，当没有方法传递时传递空字符
			}
		}
	}
}
/*
 * 为拼接好的div布局添加图表和数据表格，本方法的后三个参数functionOne为表格第一列数据链接函数名称，
 * operfunctionTwo
 */
function loadDRGsQuotaDatasub(quotaCode, quotaName,quotaType, monitorType, functionOne,operfunctionTwo) {
	paramTabPage[tabId].wardCode=$("#" + tabId + " #wardCode").val();
	$.post(contextPath + "/Monitor/monitor.dhc", {
				'dateFrom' : paramTabPage[tabId].dateFrom,
				'dateTo' : paramTabPage[tabId].dateTo,
				'mrLot' : paramTabPage[tabId].mrLot,
				'mrType' : paramTabPage[tabId].mrType,
				'compareType' : paramTabPage[tabId].compareType,
				'pType' : paramTabPage[tabId].pType,
				'monitorType' : monitorType,
				'quotaCode' : quotaCode,
				'pardepCode' : paramTabPage[tabId].depCode,
				'pardepgroupCode' : paramTabPage[tabId].depGroupCode,
				'pargroupName' : paramTabPage[tabId].groupName,
				'parwardCode' : paramTabPage[tabId].wardCode,
				'parmdcCode' : paramTabPage[tabId].mdcCode,
				'paradrgCode' : paramTabPage[tabId].adrgCode,
				'pardrgCode' : paramTabPage[tabId].drgCode
			}).done(function(data) {
		     data = data.data;
			 var columns = [{
						"data" : "ccode1",				
						"render": function(obj, type, full) {
						    if (monitorType == "depGroup" || monitorType == "mdc" || monitorType == "adrg") {
								if (full.ccode == null) {
									return "未入组";
								} else {
									if(monitorType == "mdc" || monitorType == "adrg"){
										return "<a title ='" + full.ccode
										+ "' href=\"javascript:" + functionOne + "('"
										+ full.ccode + "','" + full.ddesc
										+ "') \">" + "("+full.ccode+")" + full.ddesc + "</a>";
									}
									return "<a title ='" + full.ccode
											+ "' href=\"javascript:" + functionOne + "('"
											+ full.ccode + "','" + full.ddesc
											+ "') \">" + full.ddesc + "</a>";
								}
							}
							if (monitorType == "dep" || monitorType == "clinic") {
								return full.ddesc;
							}
							if(monitorType == "drgs"){
								if(full.ccode == null){
									return "未入组";
								}else{
									return "("+full.ccode+")" + full.ddesc;
								}
							}
						}						 
						}, {
							"data" : "QuotaValue"
						}, {
							"data" : "QuotaValuecc"
						}, { "data": "increasing","sType": "number-fate",
	                    	 "render":function(obj, type, full){
	                    	 	
//	                    		 return gridcompareValue(full.QuotaValue, full.QuotaValuecc);
			                    	if("ratio"==quotaType){
		                    			 return gridcompareValuePercent(full.QuotaValue, full.QuotaValuecc);
		                    		 }
                  		           return gridcompareValue(full.QuotaValue, full.QuotaValuecc);
	                    	 }
	                     },
	                     {
							"data" : "OPERATION",
							 "render":function(obj, type, full){  							 	
							 	if (monitorType == "mdc" || monitorType == "adrg") {
									if (full.ccode == null) {
										return "<a title='"
												+ $("#" + tabId + " #depName").val()
												+ "' class='jumplink' href=\"javascript:alertData()\"><i class='fa fa-hospital-o'></i></a>&nbsp;&nbsp;"
												+ "<a title='趋势' href=\"javascript:alertData()\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
									} else {
										return "<a title='"
								+ $("#" + tabId + " #depName").val()
								+ "' class='jumplink' href=\"javascript:"
								+ operfunctionTwo
								+ "('"
								+ full.ccode
								+ "','"
								+ full.ddesc
								+ "','"
								+ monitorType
								+ "')\"><i class='fa fa-hospital-o'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}

				}
				if (monitorType == "drgs" && functionOne != "depCli") {
					if (full.ccode == null) {
						return "<a title='"
								+ $("#" + tabId + " #depName").val()
								+ "' class='jumplink' href=\"javascript:alertData()\"><i class='fa fa-hospital-o'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:alertData()\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					} else {
						return "<a title='"+ $("#" + tabId + " #depName").val()+ "' class='jumplink' href=\"javascript:"+ operfunctionTwo
								+ "('"+ full.ccode+ "','"+ full.ddesc+ "','"+ monitorType+ "')\"><i class='fa fa-hospital-o'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"+ full.ccode+ "', '"+ full.ddesc+ "', '"+ monitorType
								+ "', '"+ quotaCode+ "', '"+ quotaName+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}
				}
				if (monitorType == "dep") {
					if (full.ccode == null) {
						return "<a title='趋势' href=\"javascript:alertData()\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					} else {
						return "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}
				}
				if (monitorType == "clinic" && functionOne != "depCli") {
					if (full.ccode == null) {
						return "<a title='病例' class='jumplink' href=\"javascript:loadDetail('"+ full.ccode+ "','"+ full.ddesc+ "','"+ monitorType+ "')\"><i class='fa fa-users'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:alertData()\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					} else {
						return "<a title='病例' class='jumplink' href=\"javascript:loadDetail('"+ full.ccode+ "','"+ full.ddesc+ "','"+ monitorType+ "')\"><i class='fa fa-users'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}
				}
				if (monitorType == "clinic" && functionOne == "depCli") {
					if (full.ccode == null) {

						return "<a title='病种' class='jumplink' href=\"javascript:alertData()\"><i class='fa fa-list-alt'></i></a>&nbsp;&nbsp;"
								+ "<a title='病例' class='jumplink' href=\"javascript:loadDetail('"+ full.ccode+ "','"+ full.ddesc+ "','"+ monitorType+ "')\"><i class='fa fa-users'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					} else {
						return "<a title='病种' class='jumplink' href=\"javascript:"
								+ operfunctionTwo
								+ "('"
								+ full.ccode
								+ "','"
								+ full.ddesc
								+ "','"
								+ monitorType
								+ "')\"><i class='fa fa-list-alt'></i></a>&nbsp;&nbsp;"
								+ "<a title='病例' class='jumplink' href=\"javascript:loadDetail('"
								+ full.ccode
								+ "','"
								+ full.ddesc
								+ "','"
								+ monitorType
								+ "')\"><i class='fa fa-users'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}

				}
				if (monitorType == "drgs" && functionOne == "depCli") {
					if (full.ccode == null) {
						return "<a title='病例' class='jumplink' href=\"javascript:loadDetail('"+ full.ccode+ "','"+ full.ddesc+ "','"+ monitorType+ "')\"><i class='fa fa-users'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:alertData()\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					} else {
						return "<a title='病例' class='jumplink' href=\"javascript:loadDetail('"
								+ full.ccode
								+ "','"
								+ full.ddesc
								+ "','"
								+ monitorType
								+ "')\"><i class='fa fa-users'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}
				} else {
					if (full.ccode == null) {
						return "<a title='病种' class='jumplink' href=\"javascript:alertData()\"><i class='fa fa-list-alt'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:alertData()\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					} else {
						return "<a title='病种' class='jumplink' href=\"javascript:"
								+ operfunctionTwo
								+ "('"
								+ full.ccode
								+ "','"
								+ full.ddesc
								+ "','"
								+ monitorType
								+ "')\"><i class='fa fa-list-alt'></i></a>&nbsp;&nbsp;"
								+ "<a title='趋势' href=\"javascript:trend('"
								+ full.ccode
								+ "', '"
								+ full.ddesc
								+ "', '"
								+ monitorType
								+ "', '"
								+ quotaCode
								+ "', '"
								+ quotaName
								+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
					}

				}
		                	 }
						}];
			 var paramsDataTables={order:[],columnDefs:[{"orderable": false,"targets":[4] }]};
				$("#" + quotaCode + "-table" + tabId).drgsDataTable(columns, data, paramsDataTables);
			})
}
//加载病例
function loadDetail(code,desc,type){
	var param = jQuery.extend(true,{},paramTabPage[tabId]);
	param.depCode=$("#" + tabId + " #depCode").val();
	if(type == "drgs"){
		param.drgCode = code;
	}else if(type == "clinic"){
		param.groupName = desc;
	}
	if(desc == null || desc == "null"){
		desc = "未入组";
	}
	openTab('/pages/drgscommon/case.jsp', desc+'病例', code+'Case' , code+'Case', param);
}
//提示未入组数据
//提示未入组数据
function alertData(){
	drgUI.warning('未入组数据!');
	return;
}

